<?
$tmpway="../";
REQUIRE ("../../protect/connect.php");
session_start();
REQUIRE ("terrain_var.inc");

 $_OPTION=1;
  SESSION_REGISTER("_OPTION");



//------------------------------------------------------------------------------
//Pour savoir qu'on est bien en train de faire le terrain

IF (!empty($p)){
     $_CHOIX=$choixtmp; //l'id du terrai
     $_STYLE=$styletmp;

	 SESSION_REGISTER("_CHOIX");//enregistrement de l'ID du terrain
     SESSION_REGISTER("_STYLE");
}
$PAGE_TMP.="choix:$_CHOIX/style:$_STYLE";

IF ( $_POST['choix_x']){
       $_CASE=$_POST['choix_x'];
       SESSION_REGISTER("_CASE");
}



//REQUIRE("terrain.php");
IF (!empty($p)){
        IF (empty($_CHOIX)){$_CHOIX=0;$_STYLE=0;}
        $query="select terrain_pic from uterrain where terrain_id=$_CHOIX";
        $resultat=mysql_query($query);
        $tmp=mysql_fetch_row($resultat);

	$cadre="../../images/terrain/$tmp[0]-$_STYLE.png";

$PAGE_TMP.="<table width=64 border=1 align=center cellpadding=0 cellspacing=0>
  <tr>";
$PAGE_TMP.="<td background=$cadre><div align=\"center\"><img src=\"$cadre\" alt=\"10\" width=\"64\" height=\"64\" border=\"0\"></div></td>";
$PAGE_TMP.="</tr></table>";
}

$PAGE_TMP.="
  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
    <tr>
      <td><div align=\"center\">
      <form name=\"form1\" method=\"post\" action=\"\">
          <input type=\"submit\" name=\"Submit\" value=\"1 C\">
            <input name=\"choix_x\" type=\"hidden\" value=\"1\"> </form>

        </div></td>
      <td><div align=\"center\">
       <form name=\"form2\" method=\"post\" action=\"\">
          <input type=\"submit\" name=\"Submit2\" value=\"3 C\">
           <input name=\"choix_x\" type=\"hidden\" value=\"2\"></form>
        </div></td>
      <td><div align=\"center\">
       <form name=\"form3\" method=\"post\" action=\"\">
          <input type=\"submit\" name=\"Submit3\" value=\"5 C\">
           <input name=\"choix_x\" type=\"hidden\" value=\"3\">   </form>
        </div></td>
      <td><div align=\"center\">
       <form name=\"form4\" method=\"post\" action=\"\">
          <input type=\"submit\" name=\"Submit4\" value=\"7 C\">
           <input name=\"choix_x\" type=\"hidden\" value=\"4\">    </form>
        </div></td>
      <td><div align=\"center\">
       <form name=\"form5\" method=\"post\" action=\"\">
          <input type=\"submit\" name=\"Submit5\" value=\"9 C\">
           <input name=\"choix_x\" type=\"hidden\" value=\"5\">    </form>
        </div></td>
    </tr>
  </table>";


//debut du tableau
$PAGE_TMP.="<table width=64 border=1 align=center cellpadding=0 cellspacing=0>
  <tr>";
$i=0;$tmp=0;
FOREACH($TER_IMAGE AS $VAR_TMP){
        $i++;$tmp++;
       $PAGE_TMP.="<td><div align=center><a name=\"a".$TER_ID[$i]."\"></a><a href=?choixtmp=".$TER_ID[$i]."&styletmp=".$TER_STYLE[$i]."&p=a&$SID#a".$TER_ID[$i]." target=_self><img src=\"../../images/terrain/".$TER_IMAGE[$i].".png\" alt=$TER_IMAGE[$i] border=0></a></div></td>";
        IF ($tmp==5){$PAGE_TMP.="</tr> <tr>";$tmp=0;}
}

//fin du tableau
$PAGE_TMP.="</tr></table>";


mysql_close();

echo $PAGE_TMP;

?>

